// pages/map/map.js
Page({
  data: {
    //自定义标记点数组
    markers: [],
    //纬度
    latitude: 32.059,
    //经度
    longitude: 118.62841,
  },
  onLoad: function () {
    var that = this
    wx.showLoading({
      title: "定位中",
      mask: true
    })
    wx.getLocation({
      type: 'gcj02',
      altitude: true, //高精度定位
      //定位成功，更新定位结果
      success: function (res) {
        var latitudee = res.latitude
        var longitudee = res.longitude
        console.log(parseFloat(longitudee));
        that.setData({
          longitude: parseFloat(longitudee),
          latitude: parseFloat(latitudee),
        })
      },
      //定位失败回调
      fail: function () {
        wx.showToast({
          title: "定位失败",
          icon: "none"
        })
      },
      complete: function () {
        //隐藏定位中信息进度
        wx.hideLoading()
      }
    })
  },

})